import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QToolBar, QStyle
from PySide6.QtGui import QAction
from PySide6.QtCore import Qt

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("3 行工具栏 × 10 图标")
        self.resize(800, 200)

        icon_names = [
            "SP_FileIcon", "SP_DirIcon", "SP_DialogSaveButton",
            "SP_DialogOpenButton", "SP_DialogCancelButton",
            "SP_DialogHelpButton", "SP_DialogApplyButton",
            "SP_DialogResetButton", "SP_DialogCloseButton",
            "SP_ComputerIcon"
        ]

        for row in range(3):
            bar = QToolBar(f"Row {row + 1}")
            bar.setToolButtonStyle(Qt.ToolButtonIconOnly)

            for idx, name in enumerate(icon_names):
                icon = self.style().standardIcon(getattr(QStyle, name))  # ← 关键修复
                act = QAction(icon, f"R{row+1}-{idx+1}", self)
                bar.addAction(act)
            
            self.addToolBar(Qt.TopToolBarArea, bar)
            self.addToolBarBreak(Qt.TopToolBarArea)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = MainWindow()
    win.show()
    sys.exit(app.exec())